﻿using AppServiceDemo.Application.Orders.Dtos;

namespace AppServiceDemo.Application.Orders
{
    public interface IOrderAppService
    {
        Task<int> CreateAsync(CreateOrderDto input);
        Task<string> UpdateAsync(int id, UpdateOrderDto input);
        Task<int> DeleteAsync(int id);
        Task<int> ApproveAsync(int id);
        Task<int> DeclineAsync(int id);
        Task<int> CancelAsync(int id);
        Task<string> PatchNameAsync(int id, PatchNameDto input);
    }

    public class OrderAppService : IOrderAppService
    {
        public Task<int> ApproveAsync(int id)
        {
            return Task.FromResult(id);
        }

        public Task<int> CancelAsync(int id)
        {
            return Task.FromResult(id);
        }

        public Task<int> CreateAsync(CreateOrderDto input)
        {
            return Task.FromResult(input.CreateOrderItems.Count);
        }

        public Task<int> DeclineAsync(int id)
        {
            return Task.FromResult(id);
        }

        public Task<int> DeleteAsync(int id)
        {
            return Task.FromResult(id);
        }

        public Task<string> PatchNameAsync(int id, PatchNameDto input)
        {
            return Task.FromResult(input.Name);
        }

        public Task<string> UpdateAsync(int id, UpdateOrderDto input)
        {
            return Task.FromResult(input.Name);
        }
    }
}